﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace AppMain
{
    class LogData
    {
        private string foldername = "LogFiles";
        private string filename = "Application.txt";

        public void Write(string info)
        {
            if(Directory.Exists(foldername) == false)
            {
                Directory.CreateDirectory(foldername);
            }

            DateTime date = DateTime.Now;
            string formatDate = "yyyyMMdd";
            StreamWriter log = new StreamWriter(string.Format("{0}\\{1}_{2}",
                                                        foldername,
                                                        date.ToString(formatDate),
                                                        filename),
                                                        true);

            log.WriteLine("{0}(UTC) {1}",DateTime.Now.ToUniversalTime().ToString("u"),info);
            log.Close();
        }
    }

}
